﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AdvanceLib.ScriptCore;
using AdvanceLib.ScriptCore.DebugCore;

namespace AdvanceLib.Extension.XseScript.DebugPasses
{
    public class EmptyInputPass : LinePass, IFinalPass
    {
        #region Fields
        private bool _isEmpty = true;
        #endregion

        #region IterativeLineDebugger Members
        public override void Pass(DebugResult result, string line)
        {
            if (!string.IsNullOrEmpty(line)) this._isEmpty = false;
        }
        #endregion

        #region IFinalDebugger Member
        public void FinalPass(DebugResult result)
        {
            if (this._isEmpty)
            {
                result.Errors.Clear();
                result.Errors.Add(new DebugError()
                {
                    Line = -1,
                    Message = "Sourcode is empty."
                });
            }
        }
        #endregion
    }
}
